<?php
declare(strict_types=1);

namespace app\admin\service;

use app\admin\model\EnterprisePath as EnterprisePathModel;

/**
 * 企业图片资源
 * Class EnterprisePathService
 * @package app\admin\service
 */
class EnterprisePathService
{
    /**
     * 企业图片资源
     * @param $where
     * @param int $assemble  1组装链接  0不组装
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function getEnterprisePath($where, $assemble = 1)
    {
        $data = EnterprisePathModel::getEnterprisePath($where);

        if ($assemble) {
            foreach ($data as $k => $v) {
                $data[$k]['path'] = config('url.url') . $v['path'];
            }
        }

        return $data;
    }

    /**
     * 创建企业图片资源
     * @param $data
     * @return EnterprisePathModel|\think\Model
     */
    public static function createEnterprisePath($data)
    {
        return EnterprisePathModel::createEnterprisePath($data);
    }

    /**
     * 删除企业图片资源
     * @param $where
     * @return bool
     */
    public static function delEnterprisePath($where)
    {
        return EnterprisePathModel::delEnterprisePath($where);
    }
}